package com.itheima.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/*
具有指定上限的线程池
 */
public class Demo02 {

    public static void main(String[] args) {
        ExecutorService pool = Executors.newFixedThreadPool(1);

        pool.submit(()->{

            System.out.println(Thread.currentThread().getName()+"正在执行了");
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        pool.submit(()->{
            System.out.println(Thread.currentThread().getName()+"正在执行了");
        });
        pool.shutdown();

    }
}
